﻿using commonImportPlugin.Common;
using commonImportPlugin.Config;
using commonImportPlugin.Configs.MedicalFile;
using commonImportPlugin.FilesCore;
using commonImportPlugin.FilesCore.MedicalFile;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace commonImportPlugin.Factorys
{

    //
    //  抽象工厂
    //
    #region
    /// <summary>
    /// 医保数据文件抽象工厂
    /// </summary>
    public abstract class AbstractMedicalFile
    {
        public abstract MedicalFileCore CreateMedicalFileCore(params object[] list);
    }
    /// <summary>
    /// 医保数据问题解析函数抽象
    /// </summary>
    public abstract class MedicalFileCore
    {
        public abstract List<MedicalData> GetMedicalAllDatas(List<string> medicalFiles, out int medicalCounts);
        public abstract int GetMedicalAllCounts(List<string> MedicalFiles);
        public abstract bool CheckMedicalData(string Data,string regex);
    }
    #endregion

    //
    //  工厂集
    //
    #region
    /// <summary>
    /// 普通模式医保数据文件解析核心类
    /// </summary>
    public class MedicalFileCoreFactory : AbstractMedicalFile
    {
        public override MedicalFileCore CreateMedicalFileCore(params object[] list)
        {
            MedicalFileCoreClass core = new MedicalFileCoreClass();
            return core.GetInstance();
        }
    }
    #endregion

    //
    //  简单工厂
    //
    #region
    /// <summary>
    /// 医保简单工厂
    /// </summary>
    public class setMedicalFileCoreFactory
    {
        public MedicalFileCore CreateFactory(string whichFatory)
        {
            switch (whichFatory)
            {
                case "General":
                    //初始化配置
                    MedicalFileConfig medicalFileConfig = new MedicalFileConfig();
                    medicalFileConfig.Init();
                    //返回初始化核心
                    return new MedicalFileCoreFactory().CreateMedicalFileCore();
                default:
                    break;
            }
            return null;
        }
    }
    #endregion
 
}
